﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;

public partial class Admin_Category_CategoryList : BasePage
{
    protected int labelId;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!int.TryParse(Request.QueryString["labelid"], out labelId))
            return;
        PageInfo.Where = " where labelid=" + labelId.ToString();
        PageInfo.OrderBy = " order by sort desc";

        if (!IsPostBack)
        {
            Delete();
            BindData();
        }
    }

    protected void BindData()
    {

        MatchIns.BLL.TCategory bll = new MatchIns.BLL.TCategory();
        List<MatchIns.Model.TCategory> ds = new List<MatchIns.Model.TCategory>();
        bll.GetList(0, bll.GetPageList(PageInfo).List, ds, "");
        gv.DataSource = ds;
        gv.DataBind();
    }

    protected void Delete()
    {
        int categoryId;
        if (int.TryParse(Request.QueryString["categoryId"], out categoryId))
            new MatchIns.BLL.TCategory().Delete(categoryId);
    }
}
